//
//  ViewController.m
//  RunTime
//
//  Created by 邢行 on 2018/11/9.
//  Copyright © 2018年 邢行. All rights reserved.
//

#import "ViewController.h"
#import <objc/runtime.h>
#import <objc/NSObjCRuntime.h>
#import "NSDictionary+uppercaseStringKey.h"

@interface ViewController ()

@property (nonatomic,strong) NSMutableDictionary *sssss;

@end

@implementation ViewController
- (NSMutableDictionary *)sssss{
    
    if (!_sssss) {
        
        _sssss = [[NSMutableDictionary alloc] init];
        NSData *data = [[self jsonStr] dataUsingEncoding:NSUTF8StringEncoding];
        NSError *error  = nil;
        _sssss = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&error];
        if (error) {
            NSLog(@"%@",[error localizedDescription]);

        }
    }
    return _sssss;
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    NSLog(@"touchesBegan");
    //消息转发机制
//    objc_msgSend(self,@selector(msgSend));
//    [self msgSend];
    
    //转换key 为大写
    [self.sssss keyCapters];

}

- (void)msgSend{
    [self logFunction];
}


/** 打印当前的方法名*/
- (void)logFunction{
    NSLog(@"%s,%d",__func__,__LINE__);
}

- (NSString *)jsonStr{
    NSString *json = @"{\"name\":\"BeJson\",\"url\":\"http://www.bejson.com\",\"page\":88,\"isNonProfit\":true,\"address\":{\"street\":\"科技园路.\",\"city\":\"江苏苏州\",\"country\":\"中国\",\"address\":{\"street\":\"科技园路.\",\"city\":\"江苏苏州\",\"country\":\"中国\"}},\"links\":[{\"name\":\"Google\",\"url\":\"http://www.google.com\"},{\"name\":\"Baidu\",\"url\":\"http://www.baidu.com\"},{\"name\":\"SoSo\",\"url\":\"http://www.SoSo.com\",\"arr2\":[{\"name\":\"Google\",\"url\":\"http://www.google.com\"},{\"name\":\"Baidu\",\"url\":\"http://www.baidu.com\"},{\"name\":\"SoSo\",\"url\":\"http://www.SoSo.com\"}]}]}";
    return json;
}

@end
